#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int i = 0;
	int a = 0;
	int b = 0;
	 int big = 0;
	static int small = 10000;
	scanf("%d\n", &i);
	for (a = 0; a < i; a++)
	{
		scanf("%d", &b);
		if (b >= big)
			big = b;
		if (b <= small)
			small = b;
	}
	int count = 0;
	count = big - small;
	printf("%d", count);
	return 0;
}